<template>
	<view class="index">
		<nav-bar title="报价结果" isBack></nav-bar>

		<view class="suceessbox">
			<scroll-view scroll-y="true" class="scroll-BOX">
			<view class="top">
				<view class="tit">您家的装修半包总估价</view>
				<view class="tits">
					{{total_price}}元
				</view>
			</view>
			<view class="detfree">
				<view>材料费：{{material_price}}元</view>
				<view>人工费：{{labor_price}}元</view>
				<view>设计费：{{design_price}}元</view>
				<view>质检费：{{check_price}}元</view>
			</view>
			<p class="tips">注：此报价为毛坯半包价，仅供您参考。因选择的材料品牌、施工工艺及实际工程质量不同，最终报价会有差异具体报价还需以装饰公司上门量房后的报价为准。</p>
			<view class="recommend"v-if="recommendLisr.length>0">
				<view class="h1">为你推荐</view>
				<view class="wrap">
					<view class="black-box" v-for="(item,index) in recommendLisr" :key="index" @tap="toDetail(item.id)">
						<view class="display_cover">
							<view class="tips-icon">
								<view class="tips_icon">
									<u-icon name="heart-fill" color="#fff" size="20"></u-icon>
									<text style="">推荐</text>
								</view>
							</view>
							<view class="i_tBtns" @tap.stop="dviewr(item)">
								<view class="i_tbImgs">
									<image src="@/static/home/3d.png"></image>
								</view>
								<view class="i_tbTxts">3D</view>
							</view>
							<image :src="item.display_cover"></image>
						</view>
						<view class="title">{{item.title}}</view>
						<view class="offer">{{item.offer}}
							<text>万</text>
						</view>
					</view>
				</view>
			</view>
			</scroll-view>
		</view>

	</view>
</template>

<script>
	import navBar from "@/components/navBar/navBar.vue"
	import service_mall from '@/service/mall.js'
	import service_design from '@/service/design'
	import URL from '@/config/url.js'
	import service_recommend from '@/service/recommend.js'

	export default {
		components: {
			navBar
		},

		data() {
			return {
				userId: "",
				total_price: 0,
				material_price: 0,
				labor_price: 0,
				design_price: 0,
				check_price: 0,
				RecommendType: 1,
				recommendLisr: [], //为你推荐
			}
		},
		onLoad(params) {
			this.$utils.getUrl();
			this.getRecommend();
			this.total_price = params.total_price
			this.material_price = params.material_price
			this.labor_price = params.labor_price
			this.design_price = params.design_price
			this.check_price = params.check_price
			this.userId = uni.getStorageSync('userId')
		},
		onShareAppMessage(res) {
			let that = this
			if (res.from === 'button') {}
			return {
				title: '融易装',
				path: '/pages_now/pages/now/quote/index?share_uid=' + this.userId,
				success: function(res) {}
			}
		},
		methods: {
			getRecommend() {
				service_recommend.getRecommendCase({
						type: this.RecommendType
					})
					.then(res => {
						if (res.code == 1) {
							var dataList = res.data
							this.recommendLisr = dataList
						}
					})
			},
			dviewr(item) {
				let url = encodeURIComponent(item.display_url)
				uni.navigateTo({
										url: '/pages_3D/pages/3D/panorama?url=' + url
				}); 
				// if(item.light_design_id){
				// 	 uni.navigateTo({
				// 		url: '/pages_3D/pages/3D/degin?obsEasyDesignId=' + item.light_design_id
				// 	 }); 
				// }else{
					 
				// }	
			},
			toDetail(caseId) {
				uni.navigateTo({
					url: '/pages_design/pages/design/demo/demo?caseId=' + caseId
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.index {
		width: 100vw;
		min-height: 100vh;
		background: url('https://cos.ryz1620.com/liankun/static/IMG279.png') no-repeat top center;
		background-size: 180% 100%;
		display: flex;
		flex-flow: column;
	}

	.suceessbox {
		width: 90%;
		background-color: #fff;
		border-radius: 10rpx;
		box-shadow: 0 5rpx 10rpx #CCC;
		margin-left: 5%;
		margin-top: 10%;
		padding-bottom:40rpx;
	}
    .scroll-BOX{
		max-height: 75vh;
	}
	.suceessbox .top {
		width: 100%;
		background: #ffe5b8;
		padding: 40rpx 30rpx;
		text-align: center;
	}

	.suceessbox .top .tit {
		font-size: 36rpx;
	}

	.suceessbox .top .tits {
		font-size: 40rpx;
		font-weight: bold;
		color: #f2121d;
		margin-top: 30rpx;
	}

	.detfree {
		padding: 40rpx 0;
		width: 100%;
		line-height: 60rpx;
		font-size: 32rpx;
		padding-left: 100rpx;
	}

	.suceessbox .tips {
		width: 90%;
		margin: auto;
		padding: 0rpx 20rpx;
		font-size: 22rpx;
		color: #666;
		line-height: 40rpx;
	}

	.recommend {
		width: 96%;
		height: auto;
		margin: 30rpx auto;

		.h1 {
			font-size: 38rpx;
			margin-left: 14rpx;
			font-weight: bold;
		}

		.wrap {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.black-box {
				width: 46%;
				margin: 2%;

				.tips-icon {
					position: absolute;
					margin-top: 16rpx;
					margin-left: 3.5%;
					z-index: 1000;

					.tips_icon {
						width: 100rpx;
						height: 38rpx;
						background: #C3AB7C;
						display: flex;
						align-items: center;
						justify-content: center;
						background: url(https://cos.ryz1620.com/liankun/static/tips.png) no-repeat;
						background-size: 100% 100%;
						margin-left: -10rpx;

						text {
							font-size: 20rpx;
							font-weight: 400;
							color: #FFFFFF;
							margin-left: 4rpx;
						}
					}
				}

				.display_cover {
					position: relative;
					height: 248rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.title {
					height: auto;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow: hidden;
					font-size: 26rpx;
				}
               .offer{
				   margin-top: 4rpx;
				   text{
					   font-size:20rpx;
					   margin-left:4rpx;
				   }
			   }
				.i_tBtns {
					width: 102rpx;
					height: 102rpx;
					background: rgba(0, 0, 0, .4);
					border-radius: 50%;
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
					z-index: 2;

					.i_tbImgs {
						width: 42rpx;
						height: 42rpx;
						margin: 20rpx auto 0;
					}

					.i_tbTxts {
						width: 100%;
						height: 34rpx;
						line-height: 34rpx;
						text-align: center;
						color: #fff;
						font-size: 24rpx;
						position: absolute;
						top: 58rpx;
						left: 0;
					}
				}
			}
		}
	}
</style>
